package com.yf.idmt;

import com.yf.idmt.dto.TestDTO;
import com.yf.idmt.idmtann.MyIdempotent;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Yang_Vincent
 * @date 2020/12/29 22:19
 */
@RestController
@RequestMapping("/index")
public class TestController {

    @GetMapping(value = "/test")
    @MyIdempotent
    public String checkAspect(String msg) {

        if (StringUtils.isNotBlank(msg)) {

            System.out.println(msg);
        }

        return "123";
    }

    @GetMapping(value = "/test1")
    @MyIdempotent
    public String checkAspectParam(TestDTO testDTO) {

        System.out.println(testDTO);

        return "123";
    }

    @RequestMapping(value = "/check", method = RequestMethod.GET)
    @MyIdempotent(message = "草,请求一次就够了")
    public String checkParam(String text) {

        return "456";
    }
}
